# Contributor: Carlgo11 <carlgo11@carlgo11.com>
# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer:
pkgname=ssh-cert-authority
pkgver=2.0.0
pkgrel=21
pkgdesc="An implementation of an SSH certificate authority"
url="https://github.com/cloudtools/ssh-cert-authority"
arch="all"
license="BSD-2-Clause"
makedepends="go"
options="net chmod-clean"
source="$pkgname-$pkgver.tar.gz::https://github.com/cloudtools/ssh-cert-authority/archive/$pkgver.tar.gz
	update-golang-sys.patch
	"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	local pkg=github.com/cloudtools/ssh-cert-authority

	HOME="$srcdir" go build \
		-ldflags "-X $pkg/version.Tag=$pkgver \
			-X $pkg/version.BuildVersion=$pkgver" \
			-o bin/$pkgname
}

check() {
	go test ./...
}

package() {
	install -Dm755 bin/$pkgname "$pkgdir"/usr/bin/$pkgname
}

sha512sums="
495b4ba72b848eeeb86869ffe312f37d4f49e6e281e840f5680e8f55cc2d29b33c771bc46ee2755d25d198e58e5dea0ce28a649321f4f979f59a1c22ed4d6f1c  ssh-cert-authority-2.0.0.tar.gz
e72c37adc42b572e5a2316e11d18ec74414343f9363de2a77bfad8ac5ffb300350a26afd67189fb33ae4ba6e16beb1dda36b37af073909e732fde38e058bb3b6  update-golang-sys.patch
"
